import http from "@/utils/http"

export function registerApi(data) {
  return http({
    url: "/api/user/register",
    data,
    method: "post",
  })
}

export function LoginApi(data) {
  return http({
    url: "/api/user/login",
    data,
    method: "post",
  })
}

export function getBillListApi(page, currentTime, id) {
  return http({
    url: `/api/bill/list?page=${page}&page_size=5&date=${currentTime}&type_id=${id}`,
    method: "get",
  })
}

export function getListApi() {
  return http({
    url: "/api/type/list",
    method: "get",
  })
}

export function addBillApi(data) {
  return http({
    url: "/api/bill/add",
    method: "post",
    data,
  })
}

export function updateBillApi(data) {
  return http({
    url: "/api/bill/update",
    method: "post",
    data,
  })
}

export function getDetailApi(id) {
  return http({
    url: `/api/bill/detail?id=${id}`,
    method: "get",
  })
}

export function deleteDetailApi(data) {
  return http({
    url: `/api/bill/delete`,
    method: "post",
    data,
  })
}

export function getDataApi(data) {
  return http({
    url: `/api/bill/data?date=${data}`,
    method: "get",
  })
}

export function getUserInfoApi() {
  return http({
    url: `/api/user/get_userinfo`,
    method: "get",
  })
}

export function upLoadImg(data, token) {
  return http({
    url: `/api/upload`,
    method: "post",
    data,
    headers: {
      "Content-Type": "multipart/form-data",
      Authorization: token,
    },
  })
}

export function editApi(data) {
  return http({
    url: `/api/user/edit_userinfo`,
    method: "post",
    data,
  })
}

export function modifyPassApi(data) {
  return http({
    url: `/api/user/modify_pass`,
    method: "post",
    data,
  })
}
